解决方法如下:
在pom.xml文件中添加json所需要的依赖
123456789101112131415161718<!--json所需要的依赖--><dependency><groupId>com.fasterxml.jackson.core</groupId><artifactId>jackson-core</artifactId><version>2.7.3</version></dependency><dependency><groupId>com.fasterxml.jackson.core</groupId><artifactId>jackson-databind</artifactId><version>2.7.3</version></dependency><dependency><groupId>com.fasterxml.jackson.core</groupId><artifactId>jackson-annotations</artifactId><version>2.7.3</version></dependency>在SpringMVC的配置文件中配置对应的Bean
1234567891011121314151617<!--转化json--><bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"><property name="messageConverters"><list><!--json视图拦截器,读取到@ResponseBody的时候去配置它--><ref bean="mappingJacksonHttpMessageConverter"/></list></property></bean><!--json转化器,它可以将结果转化--><bean id="mappingJacksonHttpMessageConverter" class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"><property name="supportedMediaTypes"><list><value>application/json;charset=UTF-8</value></list></property></bean>